package com.itheima.d05_map_treemap;

import com.itheima.d04_map_hashmap.Student;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class Test {

    public static void main(String[] args) {

        System.out.println((int)'女');
        System.out.println((int)'男');


        //1.创建HashMap集合
        Map<Student,String> stuMap = new TreeMap<>((s1,s2)->s2.getAge()-s1.getAge());

        //2.存储三个学生信息和其对应的籍贯信息，对学生年纪进行降序排序
        //存储的数据是：一一对应的数据，键值对
        stuMap.put(new Student("小王", 18, "男") , "北京");
        stuMap.put(new Student("小张", 19, "女") , "上海");
        stuMap.put(new Student("小李", 20, "男") , "广州");
        stuMap.put(new Student("小李", 20, "女") , "广州");


        //3.打印集合：遍历map
        Set<Map.Entry<Student, String>> entries = stuMap.entrySet();
        for (Map.Entry<Student, String> entry : entries) {
            Student key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key+"----->"+value);
        }

    }
}
